<template>
  <view>
    <navigator
        :openType="pages.length == 1 ? 'switchTab' : 'navigateBack'"
        :style="'top:' + nTop + 'px'"
        :url="pages.length == 1 ? '/pages/index/index4' : ''"
        class="UgobackFix"
        hoverClass="none"
    >
      <view class="i ico">{{ pages.length == 1 ? '' : '' }}</view>
    </navigator>
    <view class="banner">
      <image :src="D.path_b" mode="widthFix"></image>
    </view>
    <view :style="'--color:' + color + ';--rgbcolor:' + rgbcolor" class="izt">
      <view class="iztbox">
        <view class="ul">
          <view v-for="(item, kindidx) in KIND" :key="kindidx" :class="item.ed" :data-id="item.id" :data-idx="kindidx"
                @tap="iztFn">{{ item.title }}
          </view>
        </view>
      </view>
    </view>
    <view :class="'list' + showtype" :style="'--color:' + color + ';--rgbcolor:' + rgbcolor">
      <block v-for="(dl, index) in LIST" v-if="LIST.length > 0" :key="index">
        <navigator v-for="(item, index1) in dl" :key="index1" :url="'/pagesA/u/u?uid=' + item.uid" class="a"
                   hoverClass="none">
          <block v-if="showtype == 1">
            <view class="em">
              <image :src="item.photo_m" class="m" mode="aspectFill"></image>
              <view :style="'background:url(' + nikbg + ') repeat-x;'" class="nik">
                <text class="span">{{ item.nickname }}</text>
              </view>
              <image v-if="item.grade > 1" class="vipj" mode="widthFix" src="/static/res/img/vipj.png"></image>
            </view>
            <view class="uinfo">
              <view class="data">
                <view class="span">
                  <text class="font">{{ item.ageheighedu }}</text>
                </view>
                <view class="span">
                  <text v-if="!globalUtils.empty(item.areatitle)" class="b ico">{{ item.areatitle }}</text>
                  <text v-if="!globalUtils.empty(item.job)" class="b">{{ item.job }}</text>
                </view>
              </view>
            </view>
            <image v-if="!globalUtils.empty(item.rzj)" :src="item.rzj" class="rzj" mode="aspectFill"></image>
          </block>

          <block v-else-if="showtype == 2">
            <image v-if="item.rz_store.length > 0" :src="item.rz_store" class="rz_store"></image>
            <view class="dt">
              <image :src="item.photo_m" class="m" mode="aspectFill"></image>
              <image v-if="item.grade > 1" class="vipj" mode="widthFix" src="/static/res/img/vipj.png"></image>
            </view>
            <image v-if="!globalUtils.empty(item.rzj)" :src="item.rzj" class="rzj" mode="aspectFit"></image>
            <view class="dd">
              <view class="h4">
                <text class="span">{{ item.nickname }}</text>
                <image :src="item.grade_ico" class="ugrade1" mode="aspectFit"></image>
              </view>
              <text class="h6">{{ item.datainfo }}</text>
              <text class="h5">
                <text
                    v-for="(rs2, index2) in item.hobby"
                    :key="index2"
                    :style="'color:' + color + ';background-color:rgba(' + rgbcolor + ',.05);border-color:rgba(' + rgbcolor + ',.1);'"
                    class="li"
                >
                  {{ rs2 }}
                </text>
              </text>
              <view v-if="item.photolist.length > 0" class="pathlist">
                <image v-for="(pl, index2) in item.photolist" :key="index2" :class="item.photolist_cls" :src="pl"
                       mode="aspectFill"></image>
              </view>
            </view>
            <text v-if="!globalUtils.empty(item.distance_str)" class="gps">
              <text class="i ico"></text>
              {{ item.distance_str }}
            </text>
            <text class="em">
              <text class="div">{{ item.aboutus }}</text>
            </text>
            <view class="zoyq">
              <text :style="'background-color:' + color" class="li">寻觅</text>
              {{ item.zoyq }}
            </view>
          </block>

          <block v-else-if="showtype == 3">
            <view class="em">
              <image :src="item.photo_b" class="m" mode="widthFix"></image>
              <image v-if="item.grade > 1" class="vipj" mode="widthFix" src="/static/res/img/vipj.png"></image>
            </view>
            <view class="uinfo">
              <view class="nik">
                <view class="span">
                  <text class="h4">{{ item.nickname }}</text>
                  <image :src="item.grade_ico" class="ugrade2"></image>
                </view>
                <text class="font">{{ item.marrytime }}</text>
              </view>
              <view class="data">
                <view class="span">
                  <text v-for="(item2, index2) in item.ageheighedupay" :key="index2" class="li">{{ item2 }}</text>
                </view>
                <view class="span">
                  <text class="i ico"></text>
                  {{ item.areatitle_str }}
                </view>
              </view>
              <view class="about">{{ item.aboutus }}</view>
            </view>
            <image v-if="!globalUtils.empty(item.rzj)" :src="item.rzj" class="rzj" mode="aspectFill"></image>
            <view class="payrz">
              <view class="RZBOX">
                <text v-for="(item2, index2) in item.RZarr"
                      :key="index2" :class="'i ico ' + item2.F + ' ' + item2.ed + ' ' + item2.size"></text>
              </view>
            </view>
          </block>
        </navigator>
      </block>
    </view>
    <view v-if="izt_nodata" class="nodata">
      <image mode="aspectFit" src="/static/res/img/nodata.png"></image>
      暂无符合条件的用户　
      <text :style="'color:' + color" data-sokind="default" @tap="souboxFn">返回首页</text>
    </view>
    <view v-if="loading_flag" class="loading">
      <image v-if="loading_ico_flag" class="loading_ico" src="/static/res/img/loading_ico.svg"></image>
      <text>{{ loading_str }}</text>
    </view>
    <view class="blank">　</view>
    <view v-if="showtype_box" :class="'mask2 ' + mask_class" data-maskid="showtype_box" @tap="showtype_box_closeFn">
      <view :style="'--color:' + color" class="showtype_box">
        <view :class="'a' + (showtype == 1 ? ' ed' : '')" data-value="1" @tap="showtype_setFn">
          <text class="i ico"></text>
          头像
        </view>
        <view :class="'a' + (showtype == 2 ? ' ed' : '')" data-value="2" @tap="showtype_setFn">
          <text class="i ico"></text>
          列表
        </view>
        <view :class="'a' + (showtype == 3 ? ' ed' : '')" data-value="3" @tap="showtype_setFn">
          <text class="i ico"></text>
          大图
        </view>
      </view>
    </view>
    <view :style="'--color:' + color + ';--rgbcolor:' + rgbcolor" class="btmKefuBtn loop_s_b_s" @tap="showtypeFn">
      <block v-if="showtype == 1">
        <view class="i ico"></view>
        头像
      </block>
      <block v-else-if="showtype == 2">
        <view class="i ico"></view>
        列表
      </block>
      <block v-else-if="showtype == 3">
        <view class="i ico"></view>
        大图
      </block>
    </view>
    <view v-if="backtop_flag" :style="'color:' + color" class="backtop fadeInUp" data-id="index" @tap="backtopFn">
      <text class="ico icon-backtop"></text>
      顶部
    </view>
  </view>
</template>、
<script>
import globalUtils from "../../res/www.a9a.cn";

var t;
var a = require('../../@babel/runtime/helpers/defineProperty');
var i = require('../../res/www.a9a.cn.js');
var app = getApp();
var s = 2;
var o = true;
export default {
  computed: {
    globalUtils() {
      return globalUtils
    }
  },
  data() {
    return {
      mask_class: 'alpha0_100',
      izt_nodata: false,
      showtype: 2,
      loading_flag: false,
      loading_ico_flag: false,
      loading_str: '玩命加载中',
      backtop_flag_index: false,
      id: '',
      color: '',
      rgbcolor: '',
      backtop_flag: false,
      LIST: [],
      KIND: '',

      D: {
        path_b: ''
      },

      SHARE: '',
      showtype_box: false,
      pages: [],
      nTop: '',
      kindidx: 0,
      dl: [],
      nikbg: '',
      rs2: [],
      pl: ''
    };
  },
  onLoad: function (t) {
    var that = this;
    var s = 0;
    var o = 2;
    if (i.ifint(t.id)) {
      s = t.id;
    }
    if (i.ifint(t.showtype)) {
      o = t.showtype;
    }
    if (i.ifint(s) || i.ifint(o)) {
      that.setData({
        id: s,
        showtype: o
      });
    }
    app.globalData.get_config('_ZEAI').then(function (t) {
      that.setData({
        color: app.globalData._ZEAI.color,
        rgbcolor: i.c16_rgb(app.globalData._ZEAI.color)
      });
    });
    app.globalData.get_navigationBarTopHeight(that);
    this.init();
  },
  onPageScroll: function (t) {
    t.scrollTop > 100
        ? this.setData({
          backtop_flag: true
        })
        : this.setData({
          backtop_flag: false
        });
  },
  onReachBottom: function () {
    var i = this.LIST;
    var that = this;
    if (o) {
      o = false;
      that.setloading('start', '拼命加载中');
      app.globalData.ajax({
        url: 'izt.php',
        data: {
          submitok: 'izt',
          p: s,
          openid: t.openid,
          id: that.id,
          showtype: that.showtype
        },
        success: function (t) {
          if (1 == t.flag) {
            var e = i.length;
            if (t.LIST.length < 1) {
              that.setloading('end', '已全部加载完毕');
              return void (o = false);
            }
            that.setData(a({}, 'LIST[' + e + ']', t.LIST));
            s += 1;
            o = true;
          } else {
            uni.showToast({
              title: t.msg,
              icon: 'none',
              mask: true
            });
          }
          that.setloading('end', '上拉加载更多');
        }
      });
    }
  },
  onShareAppMessage: function (t) {
    return {
      imageUrl: this.SHARE.imgurl,
      title: this.SHARE.title,
      path: '/pagesA/izt/izt'
    };
  },
  onShareTimeline: function () {
    return {
      imageUrl: this.SHARE.imgurl,
      title: this.SHARE.title,
      query: 'id=' + this.id,
      path: '/pagesA/izt/izt'
    };
  },
  methods: {
    init: function () {
      var that = this;
      uni.showLoading({
        title: '玩命加载中...',
        mask: true
      });
      o = false;
      t = uni.getStorageSync('COOK_U');
      that.setData({
        LIST: []
      });
      s = 2;
      app.globalData.ajax({
        url: 'izt.php',
        data: {
          submitok: 'izt',
          openid: t.openid,
          id: that.id,
          showtype: that.showtype
        },
        success: function (t) {
          var e;
          if (1 == t.flag) {
            if (0 === t.LIST.length) {
              that.setData({
                LIST: [],
                KIND: t.KIND,
                izt_nodata: true,
                D: t.D,
                showtype: t.D.showtype,
                SHARE: t.SHARE
              });
            } else {
              that.setData(
                  (a((e = {}), 'LIST[0]', t.LIST),
                      a(e, 'KIND', t.KIND),
                      a(e, 'D', t.D),
                      a(e, 'showtype', t.D.showtype),
                      a(e, 'SHARE', t.SHARE),
                      e)
              );
              that.izt_nodata = false;
            }
          } else {
            uni.showToast({
              title: t.msg,
              icon: 'none',
              mask: true
            });
          }
          o = true;
          uni.hideLoading();
        }
      });
    },

    showtypeFn: function () {
      this.setData({
        showtype_box: true,
        mask_class: 'alpha0_100'
      });
    },

    showtype_setFn: function (t) {
      var a = t.currentTarget.dataset.value;
      this.setData({
        showtype: a
      });
    },

    showtype_box_closeFn: function (t) {
      var that = this;
      var e = t.currentTarget.dataset.maskid;
      this.setData({
        mask_class: 'alpha100_0'
      });
      setTimeout(function () {
        that.setData(a({}, e, false));
      }, 500);
    },

    iztFn: function (t) {
      for (var a = t.currentTarget.dataset.id, i = t.currentTarget.dataset.idx, e = this.KIND, s = e.length, o = [], n = 0; n < s; n++) {
        e[n].ed = '';
        o.push(e[n]);
      }
      o[i].ed = 'ed';
      this.setData({
        KIND: o,
        id: a
      });
      this.init();
    },

    setloading: function (t, a) {
      'start' == t
          ? this.setData({
            loading_flag: true,
            loading_ico_flag: true,
            loading_str: a
          })
          : this.setData({
            loading_flag: false,
            loading_ico_flag: false,
            loading_str: a
          });
    },

    backtopFn: function (t) {
      uni.pageScrollTo({
        scrollTop: 0,
        duration: 300
      });
    },

    souboxFn() {
      console.log('占位：函数 souboxFn 未声明');
    }
  }
};
</script>
<style>
@import 'izt.css';
</style>
